var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } { let window = _____WB$wombat$assign$function_____("window"); let self = _____WB$wombat$assign$function_____("self"); let document = _____WB$wombat$assign$function_____("document"); let location = _____WB$wombat$assign$function_____("location"); let top = _____WB$wombat$assign$function_____("top"); let parent = _____WB$wombat$assign$function_____("parent"); let frames = _____WB$wombat$assign$function_____("frames"); let opener = _____WB$wombat$assign$function_____("opener"); /* http://keith-wood.name/realPerson.html Real Person Form Submission for jQuery v2.0.1. Written by Keith Wood (kwood{at}iinet.com.au) June 2009. Available under the MIT (http://keith-wood.name/licence.html) license. Please attribute the author if you use it. */ (function($) { // Hide scope, no $ conflict var pluginName = 'realperson'; var ALPHABETIC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; var ALPHANUMERIC = ALPHABETIC + '0123456789'; var DOTS = [ [' * ', ' * * ', ' * * ', ' * * ', ' ***** ', '* *', '* *'], ['****** ', '* *', '* *', '****** ', '* *', '* *', '****** '], [' ***** ', '* *', '* ', '* ', '* ', '* *', ' ***** '], ['****** ', '* *', '* *', '* *', '* *', '* *', '****** '], ['*******', '* ', '* ', '**** ', '* ', '* ', '*******'], ['*******', '* ', '* ', '**** ', '* ', '* ', '* '], [' ***** ', '* *', '* ', '* ', '* ***', '* *', ' ***** '], ['* *', '* *', '* *', '*******', '* *', '* *', '* *'], ['*******', ' * ', ' * ', ' * ', ' * ', ' * ', '*******'], [' *', ' *', ' *', ' *', ' *', '* *', ' ***** '], ['* *', '* ** ', '* ** ', '** ', '* ** ', '* ** ', '* *'], ['* ', '* ', '* ', '* ', '* ', '* ', '*******'], ['* *', '** **', '* * * *', '* * *', '* *', '* *', '* *'], ['* *', '** *', '* * *', '* * *', '* * *', '* **', '* *'], [' ***** ', '* *', '* *', '* *', '* *', '* *', ' ***** '], ['****** ', '* *', '* *', '****** ', '* ', '* ', '* '], [' ***** ', '* *', '* *', '* *', '* * *', '* * ', ' **** *'], ['****** ', '* *', '* *', '****** ', '* * ', '* * ', '* *'], [' ***** ', '* *', '* ', ' ***** ', ' *', '* *', ' ***** '], ['*******', ' * ', ' * ', ' * ', ' * ', ' * ', ' * '], ['* *', '* *', '* *', '* *', '* *', '* *', ' ***** '], ['* *', '* *', ' * * ', ' * * ', ' * * ', ' * * ', ' * '], ['* *', '* *', '* *', '* * *', '* * * *', '** **', '* *'], ['* *', ' * * ', ' * * ', ' * ', ' * * ', ' * * ', '* *'], ['* *', ' * * ', ' * * ', ' * ', ' * ', ' * ', ' * '], ['*******', ' * ', ' * ', ' * ', ' * ', ' * ', '*******'], [' *** ', ' * * ', '* * *', '* * *', '* * *', ' * * ', ' *** '], [' * ', ' ** ', ' * * ', ' * ', ' * ', ' * ', '*******'], [' ***** ', '* *', ' *', ' * ', ' ** ', ' ** ', '*******'], [' ***** ', '* *', ' *', ' ** ', ' *', '* *', ' ***** '], [' * ', ' ** ', ' * * ', ' * * ', '*******', ' * ', ' * '], ['*******', '* ', '****** ', ' *', ' *', '* *', ' ***** '], [' **** ', ' * ', '* ', '****** ', '* *', '* *', ' ***** '], ['*******', ' * ', ' * ', ' * ', ' * ', ' * ', '* '], [' ***** ', '* *', '* *', ' ***** ', '* *', '* *', ' ***** '], [' ***** ', '* *', '* *', ' ******', ' *', ' * ', ' **** ']]; /** Create the real person plugin.
Displays a challenge to confirm that the viewer is a real person.
Expects HTML like:
<input...>
Provide inline configuration like:
<input data-realperson="name: 'value'">...>@module RealPerson @augments JQPlugin @example $(selector).realperson() $(selector).realperson({length: 200, toggle: false}) */ $.JQPlugin.createPlugin({ /** The name of the plugin. */ name: pluginName, /** The set of alphabetic characters. */ alphabetic: ALPHABETIC, /** The set of alphabetic and numeric characters. */ alphanumeric: ALPHANUMERIC, /** The set dots that make up each character. */ defaultDots: DOTS, /** More/less change callback. Triggered when the more/less button is clicked. @callback changeCallback @param expanding {boolean} True if expanding the text, false if collapsing. */ /** Default settings for the plugin. @property [length=6] {number} Number of characters to use. @property [regenerate='Click to change'] {string} Instruction text to regenerate. @property [hashName='{n}Hash'] {string} Name of the hash value field to compare with, use {n} to substitute with the original field name. @property [dot='*'] {string} The character to use for the dot patterns. @property [dots=defaultDots] {string[][]} The dot patterns per letter in chars. @property [chars=alphabetic] {string} The characters allowed. */ defaultOptions: { length: 6, regenerate: 'Click to change', hashName: '{n}Hash', dot: '*', dots: DOTS, chars: ALPHABETIC }, _getters: ['getHash'], _challengeClass: pluginName + '-challenge', _disabledClass: pluginName + '-disabled', _hashClass: pluginName + '-hash', _regenerateClass: pluginName + '-regen', _textClass: pluginName + '-text', _optionsChanged: function(elem, inst, options) { $.extend(inst.options, options); var text = ''; for (var i = 0; i < inst.options.length; i++) { text += inst.options.chars.charAt(Math.floor(Math.random() * inst.options.chars.length)); } inst.hash = hash(text + salt); var self = this; // console.log(elem); elem.focusout(function(){ var name = inst.options.hashName.replace(/\{n\}/, elem.attr('name')); var form = elem.closest('form'); form.find('input[name="' + name + '"]').remove(); form.append(''); // setTimeout(function() { // form.find('input[name="' + name + '"]').remove(); // }, 0); }); // elem.closest('form').off('.' + inst.name). // on('submit.' + inst.name, function() { // var name = inst.options.hashName.replace(/\{n\}/, elem.attr('name')); // var form = $(this); // form.find('input[name="' + name + '"]').remove(); // form.append(''); // setTimeout(function() { // form.find('input[name="' + name + '"]').remove(); // }, 0); // }); elem.prevAll('.' + this._challengeClass + ',.' + this._hashClass).remove().end(). before(this._generateHTML(inst, text)). prevAll('div.' + this._challengeClass).click(function() { if (!$(this).hasClass(self._disabledClass)) { elem.realperson('option', {}); } }); }, /* Enable the plugin functionality for a control. @param elem {element} The control to affect. */ enable: function(elem) { elem = $(elem); if (!elem.hasClass(this._getMarker())) { return; } elem.removeClass(this._disabledClass).prop('disabled', false). prevAll('.' + this._challengeClass).removeClass(this._disabledClass); }, /* Disable the plugin functionality for a control. @param elem {element} The control to affect. */ disable: function(elem) { elem = $(elem); if (!elem.hasClass(this._getMarker())) { return; } elem.addClass(this._disabledClass).prop('disabled', true). prevAll('.' + this._challengeClass).addClass(this._disabledClass); }, /* Retrieve the hash value. @param elem {Element} The control with the hash. @return {number} The hash value. */ getHash: function(elem) { var inst = this._getInst(elem); return inst ? inst.hash : 0; }, /* Generate the additional content for this control. @param inst {object} The current instance settings. @param text {string} The text to display. @return {string} The additional content. */ _generateHTML: function(inst, text) { var html = '